﻿@using DirigoEdge.Utils
@model List<Blog>

@{
    foreach (var post in Model)
    {
        <div class="relatedPost relative">
    
            <div class="categoryStick">
                <a href="/Blog/Categories/@ContentUtils.GetFormattedUrl(post.MainCategory)">@post.MainCategory</a>
            </div>
    
            <article data-id="@post.BlogId">
                @* Blog Author *@
                @{
                    var relatedUser = "Anonymous";
                    var relatedAuthorUrl = "#";
                    var image = "/Content/StockFeaturedImages/recordsPlayer.jpg";
                    if (post.Author != "")
                    {
                        relatedUser = post.Author;
                        relatedAuthorUrl = post.BlogAuthorUrl ?? "#";
                    }
                    if (post.ImageUrl != "")
                    {
                        image = post.ImageUrl;
                    }
                }
                <h5><a href="/blog/@post.PermaLink">@post.Title</a></h5>
                <div class="relatedPostImage">
                    <p>
                        <img src="@image" alt="Related Blog Image"/>    
                    </p>
                </div>
                <p>
                    Written by <a href="@relatedAuthorUrl">@relatedUser</a>
                    <span class="dateLine">@post.Date.ToLongDateString()</span>
                </p>
    
            </article>
        </div>
    }
}